package com.airwallex.util;

import com.airwallex.model.ExpParam;

import java.util.*;

/**
 * 运算器通用操作类
 */
public class CalculatorUtils {


    /**
     * 将当前操作数栈的里数据放到的日志栈中
     * @param params
     * @param log
     */
    public static void addLog(Stack<ExpParam> params, Stack<List<ExpParam>> log) {
        List<ExpParam> paramsList = new ArrayList<>();
        for (ExpParam param : params) {
            paramsList.add(param);
        }
        log.push(paramsList);
    }

    //打印栈结果
    public static void printStack(Stack<ExpParam> numbers) {
        System.out.print("stack: ");
        if (!numbers.isEmpty()) {
            for (ExpParam number : numbers) {
                System.out.print(number.getNum() + " ");
            }
        }
        System.out.println("");
    }
}
